 google.load("search", "1");    
 function OnLoad() {      
 // Create a search control     
  var searchControl = new google.search.SearchControl(); 
          
  var siteSearch = new GblogSearch();
   siteSearch.setUserDefinedLabel("站内搜索");
   siteSearch.setUserDefinedClassSuffix("siteSearch");
   siteSearch.setSiteRestriction("bestunix.net");
   //结果按日期排序
   siteSearch.setResultOrder(GSearch.ORDER_BY_DATE);
   var options=new GsearcherOptions();
	//显示全部搜索结果
   options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN );
   searchControl.addSearcher(siteSearch,options);
 
	searchControl.setLinkTarget(GSearch.LINK_TARGET_BLANK );  
	//显示8条搜索结果
	searchControl.setResultSetSize(GSearch.LARGE_RESULTSET);
	searchControl.setSearchCompleteCallback(null, procResult); 
	
	// Tell the searcher to draw itself and tell it where to attach  
	
	var searchFormElement = document.getElementById("main");
	var drawOptions = new GdrawOptions();
	//drawOptions.setSearchFormRoot(searchFormElement);
	searchControl.draw(document.getElementById("main"), drawOptions);
	
	 // Execute an inital search      
	//searchControl.execute("");   
	}    
	//处理搜索结果
	function procResult()
	{
	var result=$$('.gs-snippet');
	for(i=0;i<result.length;i++)
	{
		result[i].update(result[i].innerHTML.unescapeHTML());
	}
	
	}   	
	google.setOnLoadCallback(OnLoad); 